<template>
  <div class="zj-header" v-bind="wrapperConfig">
    <slot name="left">
      <van-icon name="arrow-left" @click="router.back()"/>
    </slot>
    <slot name="title">
      <p class="header-title">{{ title }}</p>
    </slot>
    <slot name="right">
      <van-icon class="header-placeholder"/>
    </slot>
  </div>
</template>

<script setup>
import {useRouter} from "vue-router";

const router = useRouter()
const {title, wrapperConfig} = defineProps({
  title: {
    type: String,
    default: ""
  },
  wrapperConfig: {
    type: Object,
    default: () => ({})
  }
})
</script>

<style scoped lang="less">
@import "src/assets/css/variable";

.zj-header {
  height: 50px;
  box-sizing: border-box;
  padding: 10px;
  display: flex;
  justify-content: space-between;
  font-size: 16px;
  align-items: center;
  background-color: @theme-color;
  color: #fff;
  position: relative;

  .van-icon {
    font-size: 20px;
  }

  .header-placeholder {
    width: 20px;
    height: 20px;
  }
}
</style>
